#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>

struct Node {
	int date;
	struct Node* next;
};

struct Node* initializeLinkedList() {
	struct Node* head = NULL;
	return head;
}

void insertNode(struct Node** head, int x)
{
	struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));
	newNode->date = x;
	newNode->next = NULL;
	if (*head == NULL)
	{
		*head = newNode;
	}
	else
	{
		struct Node* pcur = *head;
		while (pcur->next)
		{
			pcur = pcur->next;
		}
		pcur->next = newNode;
	}
}

void clearLinkedList(struct Node* head) {
	struct Node* current = head;
	struct Node* nextNode;
	while (current != NULL) {
		nextNode = current->next;
		free(current);
		current = nextNode;
	}
}



int main()
{
	struct Node* head = NULL;
    initializeLinkedList();
	insertNode(&head, 1);
	insertNode(&head, 2);
	insertNode(&head, 3);
	struct Node* current = head;
	while (current)
	{
		printf("%d->", current->date);
		current = current->next;
	}
	printf("NULL\n");
	while (head)
	{
		struct Node* tmp = head;
		head = head->next;
		free(tmp);
	}
	return 0;
}